#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project : bigDataProject 
@File    : printer_setup_api.py
@IDE     : PyCharm 
@Author  : Mario
@Date    : 2022/11/14 15:29 
@Describe: 中台打印机设置相关接口
"""
from typing import Text

from api.middle_api.base_middle_api import BaseMiddleAPI
from utils.common.common_control import get_shop_code


class PrinterSetupAPI(BaseMiddleAPI):

    def __init__(self, env: Text, brand_code: Text) -> None:
        super().__init__(env)
        self.brand_code = brand_code

    def pos_printer_manage_page(self, page_num='1', page_size='100'):
        """
        打印机管理分页
        :param page_num: 第几页，默认1
        :param page_size: 每页展示几条，默认100
        :return:
        """
        shop_code = get_shop_code(self.brand_code)
        payload = '{"pageNum":"' + page_num + '","pageSize":"' + page_size + '","brandCode":"' + self.brand_code + '","shopCodes":["' + shop_code + '"]} '
        response = self.http_request('catering-backend/pos/printer/manage/page', payload, "中台打印机管理分页")
        return response


if __name__ == '__main__':
    test = PrinterSetupAPI('sit', '823882')
    test.pos_printer_manage_page()
